package com.huawei.sort_algorithm;

import java.util.Random;

//测试
public class Test {
    public static void main(String[] args) {
        int length = 18000;
        Random random = new Random();
        int[] array1 = new int[length];
        int[] array2 = new int[length];
        int[] array3 = new int[length];
        int[] array4 = new int[length];
        int[] array5 = new int[length];
        int[] array6 = new int[length];
        int[] array7 = new int[length];
        int[] array8 = new int[length];
        int[] array9 = new int[length];
        int[] array10 = new int[length];
        for (int i = 0; i < 1000; i++) {
            array1[i] = random.nextInt(length);
            array2[i] = random.nextInt(length);
            array3[i] = random.nextInt(length);
            array4[i] = random.nextInt(length);
            array5[i] = random.nextInt(length);
            array6[i] = random.nextInt(length);
            array7[i] = random.nextInt(length);
            array8[i] = random.nextInt(length);
            array9[i] = random.nextInt(length);
            array10[i] = random.nextInt(length);
        }

        long currentTime;

        currentTime = System.currentTimeMillis();
        BubbleSort.bubbleSort(array1);
        System.out.println("冒泡排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("计数排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("堆排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        InsertSort.insertSort2(array4);
        System.out.println("插入排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        MergeSort.mergeSort(array5);
        System.out.println("归并排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        QuickSort.quickSort(array6);
        System.out.println("快速排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("希尔排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("选择排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("基数排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

        currentTime = System.currentTimeMillis();
        System.out.println("桶排序：" + (System.currentTimeMillis() - currentTime));
        System.out.println("##########");

    }
}
